//
//  TabBarController.m
//  EarnBao
//
//  Created by iMac on 15/4/22.
//  Copyright (c) 2015年 杭州赚宝科技有限公司. All rights reserved.
//

#import "TabBarController.h"
#import "HeadPageViewController.h"
#import "Nine_nineViewController.h"
#import "Nineteen_nineViewController.h"
#import "kindViewController.h"

@interface TabBarController ()

@end

@implementation TabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
     [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    
    //将标签控制器的标签条颜色设为白色，避免看到页面内容！
    self.tabBar.barTintColor = [UIColor whiteColor];
    
    HeadPageViewController *headPageVC = [[HeadPageViewController alloc] init];
    UINavigationController *headNav = [[UINavigationController alloc] initWithRootViewController:headPageVC];
    //设置分控制器的导航条颜色
    headNav.navigationBar.barTintColor = [UIColor colorWithRed:255/255.0 green:60/255.0 blue:120/255.0 alpha:1.0];
    //设置底部分标签的图片
    headNav.tabBarItem.image = [UIImage imageNamed:@"shouye.png"];
    //设置底部分标签的标题
    headNav.tabBarItem.title = @"首页";
    
    Nine_nineViewController *nine_nineVC = [[Nine_nineViewController alloc] init];
    UINavigationController *nine_nineNav = [[UINavigationController alloc] initWithRootViewController:nine_nineVC];
    nine_nineNav.navigationBar.barTintColor = [UIColor colorWithRed:255/255.0 green:60/255.0 blue:120/255.0 alpha:1.0];
    nine_nineNav.tabBarItem.image = [UIImage imageNamed:@"9.9.png"];
    nine_nineNav.tabBarItem.title = @"9.9";
    
    Nineteen_nineViewController *nineteen_nineVC = [[Nineteen_nineViewController alloc] init];
    UINavigationController *nineteen_nineNav = [[UINavigationController alloc] initWithRootViewController:nineteen_nineVC];
    nineteen_nineNav.navigationBar.barTintColor = [UIColor colorWithRed:255/255.0 green:60/255.0 blue:120/255.0 alpha:1.0];
    nineteen_nineNav.tabBarItem.image = [UIImage imageNamed:@"19.9.png"];
    nineteen_nineNav.tabBarItem.title = @"19.9";
    
    KindViewController *kindVC = [[KindViewController alloc] init];
    UINavigationController *kindNav = [[UINavigationController alloc] initWithRootViewController:kindVC];
    kindNav.navigationBar.barTintColor = [UIColor colorWithRed:255/255.0 green:60/255.0 blue:120/255.0 alpha:1.0];
    kindNav.tabBarItem.image = [UIImage imageNamed:@"fenlei.png"];
    kindNav.tabBarItem.title = @"分类";
    
    NSArray *navsArray = @[headNav,nine_nineNav,nineteen_nineNav,kindNav];
    self.viewControllers = navsArray;
    
    [self customizeInterface];
}
- (void)customizeInterface {
    UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
    
    UIImage *backgroundImage = nil;
    NSDictionary *textAttributes = nil;
    
    if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
       // backgroundImage = [UIImage imageNamed:@"bigShadow"];
        textAttributes = @{
                           NSFontAttributeName : [UIFont boldSystemFontOfSize:18],
                           NSForegroundColorAttributeName : [UIColor whiteColor],
                           };
    } else {
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
        //backgroundImage = [UIImage imageNamed:@"bigShadow"];
        textAttributes = @{
                           UITextAttributeFont: [UIFont boldSystemFontOfSize:18],
                           UITextAttributeTextColor: [UIColor whiteColor],
                           UITextAttributeTextShadowColor: [UIColor clearColor],
                           UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetZero],
                           };
#endif
    }
    [navigationBarAppearance setTitleTextAttributes:textAttributes];
}

@end
